package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.service.IFollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 */
@RestController
@RequestMapping("/follow")
public class FollowController {

    @Autowired
    private IFollowService followService;

    //关注或取关
    @PutMapping("/{id}/{isFollow}")
    public Result follow(@PathVariable Long id, @PathVariable boolean isFollow) {
        return followService.follow(id,isFollow);
    }

    //判断是否已关注
    @GetMapping("/or/not/{id}")
    public Result isFollow(@PathVariable int id) {
        return followService.isFollow(id);
    }

    @GetMapping("/common/{id}")
    public Result common(@PathVariable int id) {
        return followService.common(id);
    }

}
